package com.chat.chat.untils;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class ExeceptionAdvce {

//    @ExceptionHandler(Exception.class)
//    public R<?> RuntimeException(Exception e){
//        log.error("[统一异常处理]======>",e.getMessage());
//        return R.error(5500,e.getMessage());
//    }

    @ExceptionHandler(BussnissExecption.class)
    public R<?> BussnessException(BussnissExecption e){
        log.error("[Buss异常处理]======> code:{},msg:{}",e.getCode(),e.getMessage());
        return R.error(e.getCode(),e.getMessage());
    }

}
